PowerTools InputMan for Windows Forms 8.0J
GetInvalidControls メソッド
使用例 

無効なValidator.ValidateItem<T>を含むすべてのコントロールのリストを取得します。
構文
Public Function GetInvalidControls() As List(Of T)
public List<T> GetInvalidControls()

戻り値の型

無効なValidator.ValidateItem<T>を含むすべてのコントロールのリスト。
使用例
//  Please use the following namespace
//  using System.Windows.Forms;
//  using GrapeCity.Win.Editors;

public void GetsAllInvalidatedControls()
{
    // Creates an instance of a GcTextBox control.
    GcTextBox gcTextBox1 = new GcTextBox();
    // Creates an instance of a GcCommonValidator component.
    GcCommonValidator gcCommonValidator1 = new GcCommonValidator();
    // Gets all invalid controls.
    List<Control> invalidControlList = gcCommonValidator1.GetInvalidControls();
    // Checks a control has error or not.
    if (invalidControlList.Contains(gcTextBox1))
    {
        MessageBox.Show("gcTextBox has error now!");
    }
    // Gets all errors of an invalid control.
    CollectionBase<GcCommonValidator.ValidateItem> invalidItemsOnControl = gcCommonValidator1.GetInvalidItems(gcTextBox1);
    // Checks whether all related controls on a validator are valid.
    if (invalidControlList.Count == 0)
    {
        MessageBox.Show("All pass!");
    }
}
'  Please use the following namespace
'  Imports System.Windows.Forms;
'  Imports GrapeCity.Win.Editors;

Public Sub GetsAllInvalidatedControls()
    ' Creates an instance of a GcTextBox control.
    Dim gcTextBox1 As New GcTextBox()
    ' Creates an instance of a GcCommonValidator component.
    Dim gcCommonValidator1 As New GcCommonValidator()
    ' Gets all invalid controls.
    Dim invalidControlList As List(Of Control) = gcCommonValidator1.GetInvalidControls()
    ' Checks a control has error or not.
    If invalidControlList.Contains(gcTextBox1) Then
        MessageBox.Show("gcTextBox has error now!")
    End If
    ' Gets all errors of an invalid control.
    Dim invalidItemsOnControl As CollectionBase(Of GcCommonValidator.ValidateItem) = gcCommonValidator1.GetInvalidItems(gcTextBox1)
    ' Checks whether all related controls on a validator are valid.
    If invalidControlList.Count = 0 Then
        MessageBox.Show("All pass!")
    End If
End Sub
参照

Validator<T> クラス
Validator<T> メンバ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.